Fade out the last visible paragraph on access-restricted posts#71
Fade out the last visible paragraph on access-restricted posts#71bst1n wants to merge 2 commits into
Conversation
…d posts Uses a CSS mask gradient on the last <p> child of .gh-content, scoped via :has() to only apply when a .gh-post-upgrade-cta sibling is present. This gives readers a visual cue that the article continues beyond the preview, a common pattern on paywalled content (Medium, Substack, NYT…). No HTML changes, no new files.
4f5de34 to
cb33a42
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds a scoped CSS rule targeting Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@assets/css/screen.css`:
- Around line 2274-2275: The mask gradient on the paragraph is starting at 1%
which fades almost the entire block; update the mask declarations
(-webkit-mask-image and mask-image) to begin the opaque region much lower (e.g.,
change the first color stop from 1% to around 50–70%) so the majority of the
paragraph remains fully readable while only the final portion fades to
transparent; locate the two properties in the CSS and adjust the first stop
percentage to ~60% (or your desired 50–70% value).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 728c61f5-2f07-4a8c-b288-4d11a32b5ef2
⛔ Files ignored due to path filters (1)
assets/built/screen.css.mapis excluded by!**/*.map
📒 Files selected for processing (2)
assets/built/screen.cssassets/css/screen.css
Address review feedback: the previous 1% start faded almost the entire paragraph, making most of the preview text hard to read. Starting the mask at 60% keeps the bulk of the paragraph fully opaque while still fading the final portion to signal the article continues.
Problem
When a visitor lands on an access-restricted post (members-only, paid, tiers), Ghost truncates the content and renders a CTA below it. Currently the truncated paragraph ends abruptly with no visual signal that more content is hidden.
Solution
A single CSS rule that fades out the last visible paragraph via a mask gradient, scoped strictly to restricted posts (those that contain a
.gh-post-upgrade-ctaelement) using the:has()selector.Why this approach
.gh-post-upgrade-ctaexists as a direct child of.gh-content.Browser support
Uses CSS
:has()andmask-image. Both are supported in all major browsers since 2023::has(): Chrome 105+, Safari 15.4+, Firefox 121+mask-image: universalOverall browser support in late 2026 is ~98%. Visitors on older browsers see the truncated content normally — graceful degradation, no broken layout.
Opt-out
Theme overriders or end users who don't want this effect can disable it with:
Replaces previous attempt
This PR was previously a partial-based implementation with several issues (broken file extension, duplicated content, malformed HTML, no i18n). It has been rewritten with the much cleaner CSS-only approach above.